package com.jingtai.platform.controller.shop;

import com.jingtai.core.entity.BaseEntity;
import com.jingtai.core.entity.shop.MerchantsGoodsWarehouse;
import com.jingtai.platform.service.shop.MerchantsGoodsWarehouseService;
import com.jingtai.platform.util.ResultUtil;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import com.jingtai.validate.swagger.CApiParam;

/**
 * 商户商品属性表
 *
 * @author sunlaiqian
 * @date 2020-12-02 18:31:32
 */
@Validated
@RestController
@RequestMapping("/platform/merchantsgoodswarehouse")
@Api(tags = "商户商品属性表")
public class MerchantsGoodsWarehouseController{

    @Autowired
    private MerchantsGoodsWarehouseService merchantsGoodsWarehouseService;


    @ApiOperation("商户商品属性表列表查询")
    @GetMapping("/list")
    public ResultUtil aopMerchantsGoodsWarehouseList(@CApiParam(name = "page",value = "页数",required = true,cNotEmpty = true,cIntMin = 1) @RequestParam("page") Integer page,
                              @CApiParam(name = "limit",value = "每页个数",required = true,cNotEmpty = true,cIntMin = 1) @RequestParam("limit") Integer limit,
                              @CApiParam(name = "conditions",value = "查询条件",required = false) @RequestParam("conditions") String conditions){
        return merchantsGoodsWarehouseService.MerchantsGoodsWarehouselist(page, limit, conditions);
    }


    @ApiOperation("根据ID查询merchantsGoodsWarehouse实体")
    @GetMapping("/getMerchantsGoodsWarehouseById")
    public ResultUtil GetMerchantsGoodsWarehouseById(@CApiParam(name = "id",value = "merchantsGoodsWarehouse实体ID",required = true,cNotEmpty = true) @RequestParam("id") Long id){
        return merchantsGoodsWarehouseService.getMerchantsGoodsWarehouseById(id);
    }


    @ApiOperation("新增merchantsGoodsWarehouse实体")
    @PostMapping("/add")
    @ApiOperationSupport(ignoreParameters = {"merchantsGoodsWarehouse.id","merchantsGoodsWarehouse.createTime","merchantsGoodsWarehouse.updateTime","merchantsGoodsWarehouse.deleteFlag"})
    public ResultUtil aopAddMerchantsGoodsWarehouse(@RequestBody @Validated({BaseEntity.Create.class}) MerchantsGoodsWarehouse merchantsGoodsWarehouse){
        return merchantsGoodsWarehouseService.addMerchantsGoodsWarehouse(merchantsGoodsWarehouse);
    }

    @ApiOperation("编辑merchantsGoodsWarehouse实体")
    @PostMapping("/edit")
    @ApiOperationSupport(ignoreParameters = {"merchantsGoodsWarehouse.createTime","merchantsGoodsWarehouse.updateTime","merchantsGoodsWarehouse.deleteFlag"})
    public ResultUtil aopEditMerchantsGoodsWarehouse(@RequestBody @Validated({BaseEntity.Update.class}) MerchantsGoodsWarehouse merchantsGoodsWarehouse){
        return merchantsGoodsWarehouseService.editMerchantsGoodsWarehouse(merchantsGoodsWarehouse);
    }

    @ApiOperation("根据ID删除merchantsGoodsWarehouse实体")
    @GetMapping("/delMerchantsGoodsWarehouseById")
    public ResultUtil aopDelMerchantsGoodsWarehouseById(@CApiParam(name = "id",value = "merchantsGoodsWarehouse实体ID",required = true,cNotEmpty = true) @RequestParam("id") Long id){
        return merchantsGoodsWarehouseService.delMerchantsGoodsWarehouseById(id);
    }

}






